package com.sdd.dd;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
import com.alibaba.csp.sentinel.slots.block.SentinelRpcException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowException;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
import com.sdd.dd.consumer.ConsumerConfiguration;
import com.sdd.dd.consumer.UserServiceConsumer;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * ClassName: ConsumerStarter
 * Description:
 * date: 2020/6/30
 *
 * @author xugaojun
 */
public class ConsumerStarter {


    public static void main(String[] args)  {



        AnnotationConfigApplicationContext consumerContext = new AnnotationConfigApplicationContext();
        consumerContext.register(ConsumerConfiguration.class);
        consumerContext.refresh();

        UserServiceConsumer service = consumerContext.getBean(UserServiceConsumer.class);

        for (int i = 0; i < 15; i++) {
           try {
               String message = service.sayHello("xgj");
               System.out.println("Success: " + message);
           } catch (Exception e) {
               System.out.println("Block");
           }

        }
    }



}
